
all: tokenizer korpusindex bin/FastHashMap.class bin/IndexGenerator.class wordfile bin/IndexSearch.class

tokenizer: tokenizer.c
	@echo "Compiling the tokenizer..."
	gcc -o tokenizer tokenizer.c
	
bin/FastHashMap.class: src/FastHashMap.java
	@echo "Compiling dependencies..."
	javac -d bin src/FastHashMap.java

bin/IndexSearch.class: src/IndexSearch.java
	@echo "Compiling the index searcher..."
	javac -d bin -sourcepath src src/IndexSearch.java
	
bin/IndexGenerator.class: src/IndexGenerator.java
	@echo "Compiling the index generator..."
	javac -d bin -sourcepath src src/IndexGenerator.java

korpusindex: korpus
	@echo "Tokenizing the corpus..."
	./tokenizer < ./korpus | LC_ALL=C sort > ./korpusindex

wordfile: bin/IndexGenerator.class korpusindex
	@echo "Indexing the corpus index..."
	java -classpath bin IndexGenerator korpusindex

clean:
	rm -rf bin/*
	rm -f korpusindex
	rm -f triefile
	rm -f wordfile
	rm -f indexfile
	rm -f tokenizer